﻿using Abp.Application.Navigation;
using Abp.Localization;
using MyCompanyName.AbpZeroTemplate.Authorization;
using MyCompanyName.AbpZeroTemplate.Web.Navigation;

namespace MyCompanyName.AbpZeroTemplate.Web.Areas.Prm.Startup
{
    public class PrmNavigationProvider : NavigationProvider
    {
        public const string MenuName = "Prm";

        public override void SetNavigation(INavigationProviderContext context)
        {
            var menu = context.Manager.Menus[MenuName] = new MenuDefinition(MenuName, new FixedLocalizableString("Main Menu"));

            menu.AddItem(
                new MenuItemDefinition(PageNames.App.Prm.项目管理, L("ProjectManagement"),
                    icon: "icon-wrench", requiredPermissionName: AppPermissions.Pages_ProjectManager)
                .AddItem(new MenuItemDefinition(PageNames.App.Prm.项目清单, L("ProjectList"), url: "app.prm.project.Index",
                    icon: "icon-book", requiredPermissionName: AppPermissions.Pages_ProjectManager_ProjectList))
                .AddItem(new MenuItemDefinition(PageNames.App.Prm.产品列表, L("ProductList"), url: "app.prm.product.Index",
                    icon: "icon-book", requiredPermissionName: AppPermissions.Pages_ProjectManager_ProductList))
                );


            menu.AddItem(
              new MenuItemDefinition(PageNames.App.Prm.系统管理, L("SystemManager"),
                  icon: "icon-wrench", requiredPermissionName: AppPermissions.Pages_SystemManager)
                .AddItem(new MenuItemDefinition(PageNames.App.Prm.物质列表, L("Substance"), url: "app.system.substance.Index",
                    icon: "icon-book", requiredPermissionName: AppPermissions.Pages_SystemManager_Substance))
                .AddItem(new MenuItemDefinition(PageNames.App.Prm.研发中心, L("RdCenter"), url: "app.system.rdcenter.Index",
                    icon: "icon-book", requiredPermissionName: null))
                .AddItem(new MenuItemDefinition(PageNames.App.Prm.研究室, L("Laboratory"), url: "app.system.laboratory.Index",
                    icon: "icon-book", requiredPermissionName: null))
                .AddItem(new MenuItemDefinition(PageNames.App.Prm.项目角色, L("ProjectRole"), url: "app.system.project_role.Index",
                    icon: "icon-book", requiredPermissionName: AppPermissions.Pages_SystemManager_ProjectRole))
                .AddItem(new MenuItemDefinition(PageNames.App.Prm.项目角色权限, L("ProjectRoleAuth"), url: "app.system.project_role_auth.Index",
                    icon: "icon-book", requiredPermissionName: null))
                .AddItem(new MenuItemDefinition(PageNames.App.Prm.项目文档权限, L("ProjectRoleDocumentAuth"), url: "app.system.project_role_auth.Document",
                    icon: "icon-book", requiredPermissionName: null))
                .AddItem(new MenuItemDefinition(PageNames.App.Prm.系统角色权限, L("SystemRoleAuth"), url: "app.system.system_role_auth.ProjectAuth",
                    icon: "icon-book", requiredPermissionName: null))
                .AddItem(new MenuItemDefinition(PageNames.App.Prm.系统文档权限, L("SystemRoleDocumentAuth"), url: "app.system.system_role_auth.DocumentAuth",
                    icon: "icon-book", requiredPermissionName: null)).
                AddItem(new MenuItemDefinition(PageNames.App.Prm.文档类别, L("DocumentType"), url: "app.system.document_type.Index",
                    icon: "icon-book", requiredPermissionName: AppPermissions.Pages_SystemManager_DocumentType)));
        }

        private static ILocalizableString L(string name)
        {
            return new LocalizableString(name, AbpZeroTemplateConsts.LocalizationSourceName);
        }
    }
}